import request from '@/config/axios'

// 批次 VO
export interface PcVO {
  id: number // 主键id
  breedId: number // 品种id
  name: string // 名称
  manufacturer: string // 供苗厂家
  totalNum: number // 进苗总数
  num: number // 剩余数量
  inTime: Date // 进苗日期
  description: string // 描述
  status: number // 状态
  dayAge:number //天数
  weekAge:number//周数
}

// 批次 API
export const PcApi = {
  // 查询批次分页
  getPcPage: async (params: any) => {
    return await request.get({ url: `/farm/pc/page`, params })
  },

  // 查询批次详情
  getPc: async (id: number) => {
    return await request.get({ url: `/farm/pc/get?id=` + id })
  },

  // 新增批次
  createPc: async (data: PcVO) => {
    return await request.post({ url: `/farm/pc/create`, data })
  },

  // 修改批次
  updatePc: async (data: PcVO) => {
    return await request.put({ url: `/farm/pc/update`, data })
  },

  // 删除批次
  deletePc: async (id: number) => {
    return await request.delete({ url: `/farm/pc/delete?id=` + id })
  },

  // 导出批次 Excel
  exportPc: async (params) => {
    return await request.download({ url: `/farm/pc/export-excel`, params })
  },

// ==================== 子表（入舍） ====================

  // 获得入舍分页
  getInFarmhousePage: async (params) => {
    return await request.get({ url: `/farm/pc/in-farmhouse/page`, params })
  },
  // 新增入舍
  createInFarmhouse: async (data) => {
    return await request.post({ url: `/farm/pc/in-farmhouse/create`, data })
  },

  // 修改入舍
  updateInFarmhouse: async (data) => {
    return await request.put({ url: `/farm/pc/in-farmhouse/update`, data })
  },

  // 删除入舍
  deleteInFarmhouse: async (id: number) => {
    return await request.delete({ url: `/farm/pc/in-farmhouse/delete?id=` + id })
  },

  // 获得入舍
  getInFarmhouse: async (id: number) => {
    return await request.get({ url: `/farm/pc/in-farmhouse/get?id=` + id })
  },

  // 选择品种
  getVarietyApi: async () =>{
    return await request.get({url:`/farm/breed/simple-list` })
  },
  // 指定类型的农舍列表
  houseListApi:async(params:any) =>{
    return await request.get({url:`/farm/house/get-farmhouse-by-type`,params})
  },
  //蛋鸡淘汰
  eggOutApi:async(data:any)=>{
    return await request.put({
      url:`/farm/pc/in-farmhouse/eliminate`,
      data
    })
  } 
}
